//index.js
//获取应用实例
const app = getApp()
const host = require('../../config').host

Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo')
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: function () {
    this.adminExpert()
  },
  adminExpert:function(){
    var that = this
    wx.request({
      url: host+'api/user/adminExpert',
      data:{expert_id:app.globalData.id},
      success: function(res){
        console.log(res.data)
        that.setData({
          adminExpert: res.data
        })
      },
      fail: function(data){
        // console.log(data)
      }
    })
  },
  getUserInfo: function(e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }
})
